home *** CD-ROM | disk | FTP | other *** search
- #ifdef CPT_H /* Allow compiler one copy */
- #else
- #define CPT_H
-
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Module Name: cpt.h
- //
- // Description: Cpt include file for class definitions
- //
- // Written by: John Tal
- //
- //
- // Modification history:
- //
- // Date Engineer Mod # Modification Description
- //
- // 12-Feb-1992 Tal v 1.0-001 Initial conversion to C++
- //
- ////////////////////////////////////////////////////////////////////////
-
- #define CPT_BUFSIZE 1024
- #define CPT_ASCIIBYTES 255
-
- #define CPT_MAX_CONVOLUTIONS 16
-
- #define CPT_ID "CPT_KEY_FILE"
- #define CPT_VER "CPT_VER_1"
-
- #define CPT_ENCODE 0
- #define CPT_DECODE 1
- #define CPT_FILE_LEN 64
-
- #define CPT_ID_LEN 16
- #define CPT_VERS_LEN 16
- #define CPT_KEYID_LEN 16
- #define CPT_KEYSTR_LEN 14
-
- //
- // Cpt Class
- //
-
- class CPT_C
- {
-
- private:
-
- FILE *KeyFile;
- FILE *InFile;
- FILE *OutFile;
- CHAR szKeyFile[CPT_FILE_LEN];
- CHAR szInFile[CPT_FILE_LEN + 1];
- CHAR szOutFile[CPT_FILE_LEN + 1];
- UCHAR cCodes[CPT_DECODE + 1][CPT_MAX_CONVOLUTIONS][CPT_ASCIIBYTES + 1];
- INT iConvolutions;
- CHAR szCptId[CPT_ID_LEN + 1];
- CHAR szCptVers[CPT_VERS_LEN + 1];
- CHAR szCptKeyId[CPT_KEYID_LEN + 1];
- CHAR szKeyStr[CPT_KEYSTR_LEN + 1];
- INT iCurConvolution;
- INT iJobType;
-
- protected:
- SHORT lpad(PCHAR,INT);
- SHORT srep(PCHAR,CHAR,CHAR);
- SHORT MemoryKeyGen(INT);
- SHORT ReverseKeys(VOID);
- SHORT CodeBuffer(UCHAR *,UCHAR *,INT);
- SHORT AdjustConvolution(VOID);
-
- public:
- CPT_C(VOID) { };
- ~CPT_C(VOID) { };
-
- SHORT SetJobType(INT);
- SHORT GenKeys(VOID);
- SHORT WriteKeys(VOID);
- SHORT ReadKeys(VOID);
- SHORT CodeFile(VOID);
-
- SHORT OpenKeyFile(VOID);
- SHORT CloseKeyFile(VOID);
-
- SHORT OpenInFile(VOID);
- SHORT CloseInFile(VOID);
-
- SHORT OpenOutFile(VOID);
- SHORT CloseInFile(VOID);
-
- SHORT SetKeyFileStr(PCHAR);
- SHORT SetKeyStr(PCHAR);
- SHORT SetInFile(PCHAR);
- SHORT SetOutfile(PCHAR);
- SHORT SetConvolutions(SHORT);
-
- SHORT SetKeyFile(FILE *);
- };
-
-
- SHORT CptUsrGetKeyData(VOID);
- SHORT CptUsrCode(VOID);
-
-
- #endif
- #endif
-